<template>
    <div class="">
        <el-dialog title="修改会员" :visible.sync="isShow" center :before-close="cancel">
            <el-form :model="memberlist" ref="memberlist">
                <el-form-item label="手机号" :label-width="formLabelWidth">
                    <el-input v-model="memberlist.phone" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="昵称" :label-width="formLabelWidth">
                    <el-input v-model="memberlist.nickname" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="密码" :label-width="formLabelWidth">
                    <el-input v-model="memberlist.password" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="状态" :label-width="formLabelWidth">
                    <el-switch v-model="memberlist.status" active-color="#13ce66" inactive-color="#ff4949"
                        :active-value="1" :inactive-value="2">
                    </el-switch>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="cancel">取 消</el-button>
                <el-button type="primary" @click="confirm">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import { getmemberInfo, memberEdit } from '../../request/api'
import { mapActions } from 'vuex'
export default {
    props: ['isShow'],
    data() {
        return {
            memberlist: {
                nickname: '',
                phone: '',
                password: '',
                status: 1
            },
            formLabelWidth: '120px'
        }
    },
    methods: {
        lookup(uid) {
            getmemberInfo({ uid }).then(res => {
                this.memberlist = res.list
                this.memberlist.uid = uid
            })
        },
        ...mapActions({
            getMember: 'vip/getMemberAction'
        }),
        cancel() {
            this.$emit('cancel', false)
            // this.isShow=false
        },
        confirm() {
            console.log('111');
            this.$refs.memberlist.validate((val) => {
                if (val) {
                    memberEdit(this.memberlist).then(res => {
                        if (res.code == 200) {
                            this.$message.success(res.msg)
                            this.getMember()
                            this.cancel()
                        } else {
                            this.$message.error(res.msg)
                        }
                    })
                }

            })
        }
    }
}
</script>
<style scoped>

</style>